﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
//using hservice;
//using HotelWebservice . JubaWebservicer;

using HotelWebservice;
using HotelWebservice.HotelWebservice;
using System.Data;








public partial class detail : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

        
        
        //获得参数

        if (Request.QueryString.Count == 0)
        {
            return;
        }

        //if ( Request.QueryString.

        string city = Request.QueryString[QueryStrings.city].ToString();
        string 人数 = Request.QueryString[QueryStrings.人数].ToString();
        DateTime startdate = DateTime.Parse(Request.QueryString[QueryStrings.StartDate].ToString());
        DateTime enddate = DateTime.Parse(Request.QueryString[QueryStrings.Enddate].ToString());

        

        

        Search(city, 人数, startdate, enddate );

    }



    void Search(
       string city
       , string 人数
       , DateTime startdate
       , DateTime enddate
   )
    {
        this.人数TextBox4.Text = 人数;
        this.startDateTextBox2.Text = startdate.ToString();
        this.enddateTextBox3.Text = enddate.ToString();
        this.cityTextBox1.Text = city;

        HotelWebservice.HotelWebservice.RoomEnv re = new HotelWebservice.HotelWebservice.RoomEnv();
        re.Is不限制 = true;

        SearOrderType 排序方式 = SearOrderType.Recommend;


        Search(city, 人数, startdate, enddate, 0, re, 排序方式);

        
    }


     void Search(
        string city
        , string 人数
        , DateTime startdate
        , DateTime enddate
        
         ,int pageIndex
         ,RoomEnv rv
         ,SearOrderType searchOrderType
        )
    {
    
        DataSetReturn dsr = Hsbase.Search(
            int.Parse(人数)
            , startdate
            , enddate
            , rv 
            , city
            , pageIndex
            , searchOrderType
            );

        if (dsr.LoginStatus == false)
        {
            return;
        }

        Dispaly搜索结果(dsr.DataSet);

     }




    /// <summary>
    /// 显示搜索结果
    /// 注意是一个数据集过来。里面可能包含一个table，也有可能包括多个table。看搜索结果而定
    /// </summary>
    /// <param name="ds"></param>
     public void Dispaly搜索结果(DataSet ds)
     {

         DataTable d = ds.Tables[0];
         // select * from hotel_searchresults
         

         
         //this.GridView1.Visible = true;
         //this.GridView1.AutoGenerateColumns = true;
         this.GridView1.DataSource = d;

         this.Button1.Text = d.Rows.Count.ToString() + "行aasd";



     }









    protected void Button1_Click ( object sender , EventArgs e )
    {
        

    }



    HotelWebservice.HotelWebservice.HotelService hsbase;
    HotelWebservice.HotelWebservice.HotelService Hsbase
    {
        get
        {
            if (hsbase == null)
                hsbase = new HotelWebservice.HotelWebservice.HotelService();
            return hsbase;
        }

    }



}